package com.stxx.assistant.framwork.sql;

import lombok.extern.slf4j.Slf4j;
import org.noear.solon.annotation.Component;
import org.noear.solon.data.sql.SqlExecutor;
import org.noear.solon.data.sql.SqlUtilsFactory;
import org.noear.solon.data.sql.impl.SimpleSqlExecutor;

import javax.sql.DataSource;
import java.util.Arrays;

/**
 * @author Fuzhenlei
 * @date 2025/02/06 10:24
 */
@Slf4j
@Component
public class SqlUtilsFactoryImpl  implements SqlUtilsFactory {
    @Override
    public SqlExecutor create(DataSource ds, String sql, Object... args) {
        log.debug("Exec Sql:" + sql+ (args.length > 0 ? Arrays.toString(args):""));
        return new SimpleSqlExecutor(ds, sql, args);
    }
}
